package com.plm.maque.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author Limi
 * @create 2018-11-27 15:28
 */
@Data
public class PageUtils implements Serializable {
    private static final long serialVersionUID = 1L;
    //总记录数
    private long totalCount;
    //每页记录数
    private long pageSize;
    //总页数
    private long totalPage;
    //当前页数
    private long currPage;
    //是否存在上一页
    private boolean hasPrevious;
    //是否存在下一页
    private boolean hasNext;
    //列表数据
    private List<?> list;

    public PageUtils(Page<?> page) {
        this.list = page.getRecords();
        this.totalCount = page.getTotal();
        this.pageSize = page.getSize();
        this.currPage = page.getCurrent();
        this.totalPage = page.getPages();
        this.hasPrevious = page.hasPrevious();
        this.hasNext = page.hasNext();
    }

}
